#include <stdio.h>

void findTwoSum(int arr[], int size, int target) {
    for (int i = 0; i < size - 1; i++) {
        for (int j = i + 1; j < size; j++) {
            if (arr[i] + arr[j] == target) {
                printf("找到两数之和为%d的解:%d(下标：%d) + %d(下标：%d)\n", target, arr[i], i, arr[j], j);
                return;
            }
        }
    }
    printf("未找到满足条件的解。\n");
}

int main() {
    int size;

    printf("请输入数组的大小：");
    scanf("%d", &size);

    int arr[size];

    printf("请输入数组元素：");
    for (int i = 0; i < size; i++) {
        scanf("%d", &arr[i]);
    }

    int target;

    printf("请输入目标和：");
    scanf("%d", &target);

    findTwoSum(arr, size, target);

    return 0;
}